package com.hmtech.ayp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hmtech.ayp.domain.entity.Style;
import com.hmtech.ayp.enums.CommonState;
import com.hmtech.ayp.enums.DeletedFlag;
import com.hmtech.ayp.mapper.StyleMapper;
import com.hmtech.ayp.service.IStyleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements IStyleService {

    @Override
    public Style getOneById(Long id) {
        LambdaQueryWrapper<Style> queryWrapper = new LambdaQueryWrapper<Style>()
                .eq(Style::getId, id)
                .eq(Style::getStatus, CommonState.ENABLED.value)
                .eq(Style::getDeleted, DeletedFlag.NOT_DELETED.value);
        return getOne(queryWrapper);
    }

    @Override
    public List<Style> listByIds(List<Long> ids) {
        LambdaQueryWrapper<Style> queryWrapper = new LambdaQueryWrapper<Style>()
                .in(Style::getId, ids)
                .eq(Style::getStatus, CommonState.ENABLED.value)
                .eq(Style::getDeleted, DeletedFlag.NOT_DELETED.value);
        return list(queryWrapper);
    }
}
